import java.awt.event.*;
import javax.swing.*;
public class PasswordListener implements ActionListener { 
   JTextField textShow;
   public void setJTextField(JTextField t) {
      textShow=t;
   }
   public void actionPerformed(ActionEvent e) {
      JPasswordField passwordText=(JPasswordField)e.getSource();
      char [] password=passwordText.getPassword();
      String str=new String(password);
      textShow.setText("密码是:"+str);
   }
}
